using System;
using System.Windows; // 添加此行以引入 RoutedEventArgs
using System.Windows.Controls;
using System.Diagnostics;

namespace NodeEditor {

    public partial class BoolProperty : Grid {

        public delegate void VoidHandler(object v);

        public event VoidHandler valueChanged;

        public BoolProperty() {
            InitializeComponent();
        }

        private string _keyName;
        public string keyName {
            get { return _keyName; }
            set { _keyName = keyNameUI.Text = value; }
        }

        private string _keyType;
        public string keyType {
            get { return _keyType; }
            set { 
                _keyType = value; 
                keyTypeUI.Text = $"[{value}]"; 
            }
        }

        private bool _value;
        public object value {
            get { return (object)_value; }
        }

        private void fieldUI_RadioChanged(object sender, RoutedEventArgs e) {
            _value = !_value;
            valueUI.IsChecked = _value;
            valueChanged?.Invoke(_value);
        }
    }
}
